package com.hmkj.core.mapper.invest;

import com.hmkj.common.baseMapper.GenericMapper;
import com.hmkj.core.model.invest.InvestModel;
import com.hmkj.core.po.invest.Invest;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 投资人表相关Dao接口<br>
 *
 * @author lizhijie
 * @date   2018-07-05 11:19:19
 */
public interface InvestMapper extends GenericMapper< Invest,Integer> {

    /**
     * 投资人列表
     *
     * @param params
     * @return
     */
    @Select("SELECT t.*,u.user_name AS 'u.userName',u.mobile_phone AS 'u.mobilePhone' FROM s_invest t LEFT JOIN biz_user u ON u.id = t.user_id WHERE 1 = 1 ${whereSql} ${sortSql} limit ${nowPage}, ${pageSize}")
    List<InvestModel> findListBySqlJoin(Map<String, Object> params);

    /**
     * 用户统计
     *
     * @param params
     * @return
     */
    @Select("SELECT count(1) FROM s_invest t LEFT JOIN biz_user u ON u.id = t.user_id WHERE 1 = 1 ${whereSql}")
    long countBySqlJoin(Map<String, Object> params);
}
